home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / ViewCell / CellClicker.cp next >
Text File  |  2000-06-23  |  854b  |  40 lines

  1. // CellClicker.cp
  2.  
  3. #ifndef CellClicker_h
  4. #include "CellClicker.h"
  5. #endif
  6. #ifndef ViewCell_h
  7. #include "ViewCell.h"
  8. #endif
  9. #ifndef MouseDownEvent_h
  10. #include "MouseDownEvent.h"
  11. #endif
  12. #ifndef Canvas_h
  13. #include "Canvas.h"
  14. #endif
  15. #ifndef CanvasMaintainer_h
  16. #include "CanvasMaintainer.h"
  17. #endif
  18.  
  19. CellClicker::CellClicker( const MouseDownEvent& theEvent )
  20.   : CellVisitor( Rectangle( theEvent.LocalPoint().h,
  21.                                        theEvent.LocalPoint().v,
  22.                                        theEvent.LocalPoint().h + 1,
  23.                                        theEvent.LocalPoint().v + 1 ) ),
  24.      event( theEvent )
  25.   {
  26.   }
  27.  
  28. void CellClicker::Visit( ViewCell& cell, const Canvas& canvas )
  29.   {
  30.     Assert( canvas.Visible() );
  31.     Assert( canvas.Clip().Contains( event.LocalPoint() ) );
  32.     
  33.     CanvasMaintainer cm( canvas );
  34.     
  35.     if ( event.Activating() )
  36.         cell.ActivatingClick( canvas, event );
  37.      else
  38.         cell.Click( canvas, event );
  39.   }
  40.